package com.suwish.pc.ui.preference;

import java.util.ArrayList;
import java.util.List;

import com.suwish.pc.phone.PhoneManager;
import com.suwish.pc.ui.main.MainFrame;
import com.suwish.pc.ui.preference.impl.SystemConfigPreference;

/**
 * 
 * 
 * @author Min
 *
 */
public class PreferenceManager {
	
	
	List<Preference> preferences = null;
	PreferenceDialog dialog = null;
	/**
	 * 
	 * 禁止直接实例化当前对象，当前对象的调用使用
	 * {@link PhoneManager#getPerferenceManager()}获得
	 * 
	 */
	public PreferenceManager(){
		init();
	}
	
	
	private void init(){
		preferences = new ArrayList<Preference>();
		dialog = new PreferenceDialog(MainFrame.getInstance());
		addPreference(new SystemConfigPreference());
	}
	
	public void addPreference(Preference preference){
		preferences.add(preference);
	}
	
	
	/**
	 * 
	 * 展开首选项对话框。
	 * 
	 */
	public void showDialog(){
		dialog.initData(preferences);
		dialog.setVisible(true);
	}
}
